package com.lagou;

import com.lagou.bean.Resume;
import com.lagou.repository.ResumeRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.util.Date;
import java.util.List;

/**
 * @ClassName: MongoTemplateMain
 * @Description:
 * @Author: qjc
 * @Date: 2021/11/15 5:25 下午
 */
@SpringBootApplication
public class MongoRepositoryMain {

    public static void main(String[] args) {
        String name = "111";
        double expectSalary = 1.;
        ApplicationContext applicationContext = SpringApplication.run(MongoRepositoryMain.class, args);
        ResumeRepository resumeRepository = applicationContext.getBean(ResumeRepository.class);
        Resume resume = new Resume();
        resume.setName(name);
        resume.setExpectSalary(expectSalary);
        resume.setCity("bj");
        resumeRepository.save(resume);

        List<Resume> resumeRepositoryAll = resumeRepository.findAll();
        for (Resume resume1 : resumeRepositoryAll) {
            System.out.println("1-----" + resume1);
        }

        List<Resume> ceshi = resumeRepository.findByNameEquals(name);
        for (Resume resume1 : ceshi) {
            System.out.println("2------" + resume1);
        }

        List<Resume> ceshi1 = resumeRepository.findByNameAndExpectSalary(name, expectSalary);
        for (Resume resume1 : ceshi1) {
            System.out.println("3------" + resume1);
        }


    }

}
